<!--
 * @Author: liyin 2179253556@qq.com
 * @Date: 2023-03-07 16:16:18
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2025-05-06 09:37:20
 * @FilePath: App.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div id="app">
    <router-view :style="'min-height:' + clientHeight + 'px;'" :key="route.fullPath"
      v-if="!route.meta.keetAlive"></router-view>
    <router-view v-slot="{ Component }" :key="route.fullPath"
      :style="'min-height:' + (route.path != '/records' && route.path != '/recordsTwo' ? clientHeight : clientHeight2) + 'px;'">
      <transition name="van-fade" mode="out-in">
        <keep-alive include="/login">
          <component :is="Component" v-if="route.meta.keetAlive" />
        </keep-alive>
      </transition>
    </router-view>
    <van-overlay :show="overlayShow" @click="overlayShow = false">
      <div class="wrapper">
        <div class="block">
          <van-image :src="gzhImg" fit="cover"></van-image>
        </div>
      </div>
    </van-overlay>
  </div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import gzhImg from '@/assets/images/serve_img.png'
const overlayShow = ref(false)
const route = useRoute()
const clientHeight = window.innerHeight
const clientHeight2 = window.innerHeight
const changeLay = () => {
  overlayShow.value = !overlayShow.value
}
onMounted(() => {
  // 禁止双指方法
  document.documentElement.addEventListener(
    'touchstart',
    function (event) {
      if (event.touches.length > 1) {
        event.preventDefault()
      }
    },
    false
  )
  // 禁止双击放大
  var lastTouchEnd = 0
  document.documentElement.addEventListener(
    'touchend',
    function (event) {
      var now = Date.now()
      if (now - lastTouchEnd <= 300) {
        event.preventDefault()
      }
      lastTouchEnd = now
    },
    false
  )
})
</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #333;
  position: relative;
  /* overflow: hidden; */
}
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.block {
  width: 100%;
  padding: 0 5%;
  height: auto;
  box-sizing: border-box;
  background-color: transparent;
}
.van-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99 !important;
}
</style>
